//
//  YYT_MVModel.m
//  AudioVisualFeast
//
//  Created by 张琪 on 16/1/28.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "QL_MVModel.h"

@implementation QL_MVModel
-(instancetype)initWithDictionary:(NSDictionary *)dic {
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dic];
        
    }
    return self;
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key {
    if ([key isEqualToString:@"id"]) {
        self.ids = value;
    }
    if ([key isEqualToString:@"description"]) {
        self.descriptions = value;
    }
    if ([key isEqualToString:@"relatedVideos"] || [key isEqualToString:@"videos"]) {
        NSArray *array = value;
        NSMutableArray *array2 = [[NSMutableArray alloc] initWithCapacity:0];
        for (NSDictionary *dic in array) {
            QL_ModleShared *model = [[QL_ModleShared alloc] initWithDictionary:dic];
            [array2 addObject:model];
        }
        self.relatedVideo = [[NSArray alloc] initWithArray:array2];
    }
    
    if ([key isEqualToString:@"artists"]) {
        NSArray *array = [[NSArray alloc] initWithArray:value];
        NSDictionary *dic = [[NSDictionary alloc] initWithDictionary:array[0]];
        self.artistAvatar = dic[@"artistAvatar"];
    }
    if ([key isEqualToString:@"creator"]) {
        self.nickName = value[@"nickName"];
    }
}
-(id)valueForUndefinedKey:(NSString *)key {
    return nil;
}

@end
